home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / DATABASE.DIR / 00108_Script_CHECK DATABASE - BROWSER < prev    next >
Text File  |  1996-03-28  |  1KB  |  41 lines

  1. -- --------------------------------------------------------------
  2. -- Handler checkArticleCasts checks that every topic in the field
  3. -- "BrowserTopics" has an associated article field. Errors are
  4. -- place in the field "browserTopics without articles"
  5.  
  6. on checkArticleCasts numLinesPerBrowserTopic
  7.   if voidP(numLinesPerBrowserTopic) then
  8.     set numLinesPerBrowserTopic = 1
  9.   end if
  10.   
  11.   set browserTopics = field "browserTopics"
  12.   set numLines = the number of lines in browserTopics
  13.   set numTopics = (numLines - (numLines/numLinesPerBrowserTopic -1)) / numLinesPerBrowserTopic
  14.   
  15.   put EMPTY into field "browserTopics without articles"
  16.   
  17.   set curLine = 1
  18.   
  19.   -- go through the browser topics one by one
  20.   repeat while (curLine <= numLines)
  21.     set curTopic = line curLine of browserTopics
  22.     put "checking" && curtopic
  23.     
  24.     if (curTopic <> EMPTY) then
  25.       set articleCast = the number of cast (curTopic && "TEXT1")
  26.       
  27.       if (articleCast = -1) then
  28.         -- browserTopic error
  29.         put curTopic & RETURN after field "browserTopics without articles"
  30.       end if -- articleCast = -1
  31.     end if
  32.     
  33.     if (numLinesPerBrowserTopic = 1) then -- no return between lines
  34.       set curLine = curLine + 1
  35.     else 
  36.       set curLine = curLine + numLinesPerBrowserTopic + 1 -- +1 for the RETURN
  37.     end if
  38.     
  39.     
  40.   end repeat -- going through the topics
  41. end